package com.cykj.page04.service.impl;

import com.cykj.page04.dao.impl.UserDaoImpl;
import com.cykj.page04.dto.ResponseDTO;
import com.cykj.page04.entity.StudentDO;
import com.cykj.page04.service.IUserService;

/**
 * @BelongsProject: HandTomcat
 * @BelongsPackage: com.cykj.page03.service.impl
 * @Author: WWJ
 * @CreateTime: 2025-06-18 23:29
 * @Description: TODO
 * @Version: 1.0
 */
public class UserServiceImpl implements IUserService {


    @Override
    public ResponseDTO login(String account, String password) {
        UserDaoImpl userDao = new UserDaoImpl();

        StudentDO student = userDao.login(account, password);
        if (student != null) {
            return ResponseDTO.success(student);
        }
        return ResponseDTO.error("登录失败");
    }

    @Override
    public ResponseDTO enroll(String account, String password, String name) {
        UserDaoImpl userDao = new UserDaoImpl();
        Integer res = userDao.enroll(account,password,name);
        return ResponseDTO.success(res);
    }
}
